package com.ezops.poc.transformer;

import java.util.Arrays;
import java.util.Map;

import org.dozer.DozerBeanMapper;
import org.springframework.stereotype.Component;

import com.ezops.poc.bo.EzopsBondModel;
import com.ezops.poc.bo.EzopsCDSModel;
import com.ezops.poc.bo.EzopsEquityModel;
import com.ezops.poc.bo.EzopsOTEquityModel;
import com.ezops.trade.processing.partners.calypsodocument.CalypsoUploadDocument;
import com.ezops.trade.processing.partners.orchestrade.cds.OrchesTradeCDSModel;
import com.ezops.trade.processing.partners.orchestrade.equity.OrchesTradeEquityModel;

/**
 * Converts the Ezops model into the destination format.
 * @author vgaurav
 *
 */
@Component(value="destinationFormatConverter")
public class DestinationFormatConvertor {

	public CalypsoUploadDocument convert(EzopsBondModel data) {
		DozerBeanMapper mapper = new DozerBeanMapper(Arrays.asList(new String[]{"ezopsBondInvestOneMapping.xml"}));
		return mapper.map(data, CalypsoUploadDocument.class);
	}
	
	public CalypsoUploadDocument convert(EzopsEquityModel data) {
		DozerBeanMapper mapper = new DozerBeanMapper(Arrays.asList(new String[]{"ezopsBondInvestOneMapping.xml"}));
		return mapper.map(data, CalypsoUploadDocument.class);
	}
	
	/**
	 * Convert the EzopsCdsModel into OrchesTradeCDSModel.
	 * Assumption - The field names in both the models are same, so using default dozer mapping.
	 * @param data
	 * @return
	 */
//	public OrchesTradeCDSModel convert(EzopsCDSModel data) {
//		DozerBeanMapper mapper = new DozerBeanMapper();
//		return mapper.map(data, OrchesTradeCDSModel.class);
//	}
	
	public OrchesTradeEquityModel convert(EzopsOTEquityModel data) {
		DozerBeanMapper mapper = new DozerBeanMapper();
		return mapper.map(data, OrchesTradeEquityModel.class);
	}
}
